home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / boot / BlizKick.lha / BlizKick / Modules / RebootFix.ASM < prev    next >
Assembly Source File  |  2000-09-04  |  3KB  |  122 lines

  1. ; FILE: Source:modules/RebootFix.ASM          REV: 8 --- Fix problem with multisync reboot
  2.  
  3. ;
  4. ; RebootFix module for BlizKick
  5. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6. ;
  7. ; V1.3 - 5th Aug 2000
  8. ; Fucked up if the module patch was installed inside ROM. Fixed.
  9. ;
  10. ; Written by Harry Sintonen.
  11. ; This source code is Public Domain.
  12. ;
  13. ;
  14.  
  15.     incdir    "include:"
  16.     include    "blizkickmodule.i"
  17.  
  18.  
  19.     SECTION    PATCH,CODE
  20. _DUMMY_LABEL
  21.     BK_PTC
  22.  
  23. ; Code is run with following incoming parameters:
  24. ;
  25. ; a0=ptr to ROM start (buffer)    eg. $1DE087B8
  26. ; a1=ptr to ROM start (ROM)    eg. $00F80000 (do *not* access!)
  27. ; d0=ROM lenght in bytes    eg. $00080000
  28. ; a2=ptr to _FindResident routine (will search ROM buffer for resident tag):
  29. ;    CALL: jsr (a2)
  30. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to resident name
  31. ;     OUT: d0=ptr to resident (buf) or NULL
  32. ; a3=ptr to _InstallModule routine (can be used to plant a "module"):
  33. ;    CALL: jsr (a3)
  34. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to module, d6=dosbase
  35. ;     OUT: d0=success
  36. ; a4=ptr to _Printf routine (will dump some silly things (errormsg?) to stdout ;-)
  37. ;    CALL: jsr (a4)
  38. ;      IN: a0=FmtString, a1=Array (may be 0), d6=dosbase
  39. ;     OUT: -
  40. ; d6=dosbase, a6=execbase
  41. ;
  42. ; Code should return:
  43. ;
  44. ; d0=true if succeeded, false if failed.
  45. ; d1-d7/a0-a6 can be trashed. a7 *must* be preserved! ;-)
  46.  
  47.     cmp.w    #37,($C,a0)        ;requires V37+ rom image
  48.     bhs.b    .cont
  49.     moveq    #0,d0
  50.     rts
  51.  
  52. .cont    moveq    #0,d7
  53.  
  54.     move.l    a0,a1
  55.     move.l    #$397C0200,d1
  56.     move.w    #512-1,d2
  57. .findl    subq.w    #1,d2
  58.     beq.b    .badrom
  59.     addq.l    #2,a1
  60.     cmp.l    (a1),d1
  61.     bne.b    .findl
  62.     cmp.w    #$0100,(4,a1)
  63.     bne.b    .findl
  64.  
  65.     move.w    #$4EB9,(a1)+        ;create jsr
  66.     move.l    a1,a5
  67.  
  68.     move.l    d0,d5
  69.     lea    (_rebootfix_module,pc),a1
  70.     jsr    (a3)            ;call _InstallModule
  71.     move.l    d0,d1
  72.     move.l    d5,d0
  73.     tst.l    d1
  74.     beq.b    .nomod
  75.  
  76.     lea    (_name,pc),a1
  77.     jsr    (a2)            ;call _FindResident
  78.     tst.l    d0
  79.     beq.b    .nomod
  80.  
  81.     move.l    d0,a0
  82.     moveq    #_earlycode-_init,d0
  83.     add.l    (RT_INIT,a0),d0
  84.     move.l    d0,(a5)
  85.  
  86.  
  87.     moveq    #1,d7
  88. .nomod
  89. .badrom
  90.     move.l    d7,d0
  91.     rts
  92.  
  93.     CNOP    0,4
  94. _rebootfix_module
  95.  BK_MOD BKMF_SingleMode,_end,(0)<<24+37<<16+NT_UNKNOWN<<8+(256-128),_name,_idstr,_init
  96.  
  97. ; Singlemode on,
  98. ; NEVER INIT module, requires KS V37.x or better, module type NT_UNKNOWN, priority -128.
  99.  
  100. _init    rts
  101.  
  102. _earlycode    move.w    #$0200,($100,a4)    ; Colour burst on!
  103.  
  104.     move.l    d0,-(sp)
  105.     moveq    #3,d0
  106.     swap    d0            ; some delay
  107. .loop    move.w    #$0020,($1DC,a4)    ; set PAL
  108.     subq.l    #1,d0
  109.     bne.b    .loop
  110.     move.l    (sp)+,d0
  111.     rts
  112.  
  113. _name
  114. _idstr    dc.b    'RebootFix patch',0
  115.     CNOP    0,2
  116. _end
  117.  
  118.     SECTION    VERSION,DATA
  119.  
  120.     dc.b    '$VER: RebootFix_PATCH 1.3 (5.8.00)',0
  121.  
  122.